package com.wenhai.spring.dependency.lookup;

import com.wenhai.xiaomage.spring.ioc.overview.dependency.domain.User;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @ClassName SingletonBeanRegisterDemo
 * @Description
 * @Author 谢文海
 * @Date 2021/4/2 0:14
 * @Version 1.0
 **/
public class SingletonBeanRegisterDemo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.getBeanFactory().registerSingleton("user", new User());
        ctx.refresh();
        System.out.println(ctx.getBean("user", User.class));
        ctx.close();
    }
}
